<?php
	$fields_arr = array(
		'serial_no'=>'流水号',
		'username'=>'大塑账户',
		'amount'=>'发生额(￥)',
		'usable'=>'可用资金(￥)',
		'atype'=>'资金类型',
		'type_name'=>'业务类型',
		'type'=>'具体业务',
		'addtime'=>'交易时间',
	);
	if(!$custom_field_arr){
	$custom_field_arr = array_flip($fields_arr);
	}
	$fields_arr_new = array_merge($custom_field_arr,array_flip($fields_arr));
	$fields_arr_new = array_unique($fields_arr_new);
?>
{include app:admin.inc.header}
<!--tmpl-resource-->
{include app:admin.inc.top}
<link rel="stylesheet" href="/res/js/framework/nestable/nestable.css">
<div class="container-fluid content-body">
	<div class="main">
		<!-- left side start-->
	
		
		<section class="left-section">
			<dl id="leftNav" data-type="fund">
				<dt><i class="glyphicon glyphicon-usd"></i> 资金管理</dt>
				{if in_case_array('admin/fund/index',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/fund/index}">资金总览</a></dd>
				{/if}

				{if in_case_array('admin/fund/log',$priv) || empty($priv)}
				<dd><a class="mb active" href="{url /admin/fund/log}">资金流水</a></dd>
				{/if}
			</dl>
		</section>
		<!-- left side end-->
		<!-- main content start-->
		<section class="right-section" id="right-section">
			{include admin.inc.bread}
			<h2 class="header">{$title}</h2>
			<!-- start of inner-frame -->
			<div class="inner-iframe">
				<!-- Nav tabs -->
				
				
				<div class="inner-container">
					<form class="form-inline search-form" role="form" id="J_List_Form>
						<input type="hidden" name="pagesize" value="{$pagesize}" >
						<!-- search form start -->
						<!--tmpl-search-->

						<!-- searchinput -->
						<nav class="inline-form clearfix">
							<div class="r">
								<div class="form-group">
									<div class="input-group">
										<div class="input-group-addon">
											流水号
										</div>
										<input type="text" class="form-control input-sm" maxlength="28" placeholder="" name="serial_no" value="{$serial_no}">
									</div>
								</div>
								<div class="form-group">
									<div class="input-group">
										<div class="input-group-addon">
											大塑账户
										</div>
										<input type="text" class="form-control input-sm" maxlength="{maxlength}" placeholder="" name="username" value="{$username}">
									</div>
								</div>
								<div class="form-group">
									<div class="input-group">
										<div class="input-group-addon">
											订单号
										</div>
										<input type="text" class="form-control input-sm" maxlength="{maxlength}" placeholder="" name="order_no" value="{$order_no}">
									</div>
								</div>
								<div class="form-group">
									<div class="css-select">
										<div class="chosen">
											<span></span>
											<i class="angle-down"></i>
											<input type="hidden" name="type" value="{$type}">
										</div>
										<ul style="z-index:999;">
											<li data-value="">-业务类型-</li>
											<li data-value="pay">支付</li>
											<li data-value="confirm">确认收货</li>
											<li data-value="inpay">入金</li>
											<li data-value="outpay">出金</li>
										</ul>
									</div>
								</div>
								<div class="form-group">
									<div class="input-group">
										<div class="input-group-addon">
											交易时间
										</div>
										<input style="width:100px;" class="form-control form-control-inline input-sm mdate"  size="16" type="text"
											   name="s_time" value="{$s_time}"
											   placeholder="开始时间" />

										<div class="input-group-addon">
											-
										</div>
										<input style="width:100px;" class="form-control form-control-inline input-sm mdate"  size="16" type="text"
											   name="e_time" value="{$e_time}"
											   placeholder="结束时间" />
									</div>
								</div>

								<input type="hidden" name="order" value="{$order}">
								<input type="hidden" name="pagesize" value="{$pagesize}">
								<button type="submit" class="btnlg mb">搜索</button>
								<button type="button" class="btnlg mb" id="J_Export_btn">导出Excel</button>
								<button type="button" class="btnlg mb" id="defined">配置列表项</button>
							</div>

						</nav>
						<!-- search form end -->
					<!--</form>
					<form id="J_List_Form">-->
						<div class="table-responsive">
							<table id="J_ListTable" class="table  table-hover  table-striped">
								<thead>
									<tr>
										<th width="20">
										<label class="css-checkbox"><input type="checkbox" class="check-all" /><span></span></label>
										</th>
										{loop $custom_field_arr $k $v}
										<th>{$fields_arr[$v]}</th>
										{/loop}
									</tr>
								</thead>
								<tbody>
								{if empty($items)}
								<tr>
									<td style="text-align:center;" colspan="14" class="empty-table-td">{$emptyRecord}</td>
								</tr>
								{/if}
								{loop $items $value}
								<tr>
									<td><label class="css-checkbox"><input type="checkbox" name="ids[]" value="{$v[id]}"/><span></span></label>
									</td>
									{loop $custom_field_arr $v}
									{if $v=='atype'}
									<td>
										{if $value[atype] == '+'}
										<span class="label label-success">收入</span>
										{elseif $value[atype] == '-'}
										<span class="label label-danger">支出</span>
										{else}
										---
										{/if}
									</td>
									{else}
									{if $v=='type'}
									<td>{if $value[type]=='pay' || $value[type]=='confirm'}订单号：{$value[order_no]}{else}-{/if}</td>
									{else}
									<td>{$value[$v]}</td>
									{/if}
									{/if}
									{/loop}
								</tr>
								{/loop}
							</table>
						</div>
					</form>
					<div class="text-right">
						{$pagemenu}
					</div>
				</div>
			</div>
		</section>
	</div>
</div>

<!--footer section start-->
{include admin.inc.footer}
<!--footer section end-->

<!--tmpl-script-->
<!--自定义start-->
<script id="defined_table" type="text/html">
	<div>
		<form id="defined_edit" class="form-horizontal">
			<input type="hidden" name="url" value="{$module}/{$action}/{$method}">
			<div class="de_title"><i></i>拖动改变顺序</div>
			<div class="cf">
				<div class="dd" id="nestable3">
					<ol class="dd-list">
						{loop $fields_arr_new $v}
						<li class="dd-item dd3-item" data-id="{$v}">
							<div class="dd-handle dd3-handle"></div><div class="dd3-content">
							<label class="css-checkbox">
								<input type="checkbox" {if in_array($v,$custom_field_arr)}checked="checked"{/if} name="field_arr[]" value="{$v}">
								<span>{$fields_arr[$v]}</span>
							</label>
						</div>
						</li>
						{/loop}
					</ol>
				</div>
			</div>
		</form>
	</div>
</script>
<!--自定义end-->

<!-- pagescript -->
<script type="text/javascript">
	seajs.use("admin/trading_orderindex",function (exports){
		exports.init({
			billRecordsUrl : '/admin/order/billRecords',//获取资金流水
			confirmOrderPayUrl : '/admin/order/confirmOrderPay',//确认收款
			addShippingUrl : '/admin/order/delivery',//确认收款
		});
	});
</script>


<script id="assocpage" type="text/html">
<div class="text-right">
	<ul class="pagination blog-pagination">
		<li><a class="assoc-page" data-page="{[prev]}" href="javascript:void(0);">上一页</a></li> 
		{[loop pages page]}

		<li {[if curr == page]}class="active"{[/if]}><a class="assoc-page" data-page="{[page]}"  href="javascript:void(0)">{[page]}</a></li> 

		{[/loop]}
		<li><a class="assoc-page" href="javascript:void(0);" data-page="{[nexts]}">下一页</a></li> 
	</ul>	
</div>
</script>
</body>
</html>
